Skip to content

Fix #1506 config file locating issue #1507

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

Ultimater
Copy link
Member

@Ultimater Ultimater commented Jul 5, 2021

Hello!

In raising this pull request, I confirm the following (please check boxes):

  • I have read and understood the [Contributing Guidelines][:contrib:]
  • I have checked that another pull request for this purpose does not exist
  • I wrote some tests for this PR

Small description of change:

Fixes issue where

phalcon create-controller --name test

defaults to NULL as the directory where it searches for the config.php file in the wrong place, /, upon not finding it, the code falls back to a recursive directory search logic which then finds the public/webtools.config.php file and loads up the wrong config file causing an error:

PHP Fatal error: Uncaught Error: Call to a member function path() on int in /var/www/repos/phalcon-devtools/scripts/Phalcon/Builder/Controller.php:74
Stack trace:
#0 /var/www/repos/phalcon-devtools/scripts/Phalcon/Commands/Builtin/Controller.php(74): Phalcon\Builder\Controller->build()
#1 /var/www/repos/phalcon-devtools/scripts/Phalcon/Script.php(117): Phalcon\Commands\Builtin\Controller->run(Array)
#2 /var/www/repos/phalcon-devtools/scripts/Phalcon/Script.php(151): Phalcon\Script->dispatch(Object(Phalcon\Commands\Builtin\Controller))
#3 /var/www/repos/phalcon-devtools/phalcon(76): Phalcon\Script->run()
#4 {main}
thrown in /var/www/repos/phalcon-devtools/scripts/Phalcon/Builder/Controller.php on line 74

This can be worked around with:

phalcon create-controller --name test --directory .

but the code should not error when not specifying a directory.

Thanks

@Ultimater Ultimater merged commit d31bc7c into phalcon:3.4.x Jul 5, 2021
@Ultimater Ultimater deleted the fix-1506-cannot-create-controllers branch July 5, 2021 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant